<table id="everybody" class="datatable table table-striped table-bordered" >
  <caption>
    <h3 class="data-table-title"><%= @page_title %></h3>
    <!-- decides whether or not to render create event button  -->
    <% if can? :create, Person %>
      <a role="button" class='js-create-person add-btn btn' href='<%= new_person_path %>'><p>+</p></a>
    <% end %>
    <%= render 'shared/filter_by_dept' %>
  </caption>
  <thead>
    <tr>
      <th>(S) Rank Order</th>
      <th>Title</th>
      <th>(S) Last Name</th>
      <th>Name</th>
      <th>(S) Start Date</th>
      <th>Duration</th>
      <th>Dept</th>
      <th>Last Response</th>
      <th>Last Available</th>
      <th>Last Worked</th>
      <th>Last 3/6/12 Months</th>
      <th>Status</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% @people.each do |person| %>
      <tr>
        <td><%= Person::TITLE_ORDER[person.title] %></td>
        <td><%= person.shortrank %></td>
        <td><%= person.lastname %></td>
        <td><%= link_to person.fullname, person %></td>
        <td><%= person.start_date %></td>
        <td title=<%= person.start_date %> >
          <%= distance_of_time_in_words(((person.end_date) || Date.today), person.start_date) if person.start_date %>
        </td>
        <td><%= "#{person.dept_shortname} #{person.division1}" %></td>
        <%= display_date_with_days_hint(person, 'date_last_responded') %>
        <%= display_date_with_days_hint(person, 'date_last_available') %>
        <%= display_date_with_days_hint(person, 'date_last_worked') %>
        <%= display_hours_worked(person) %>
        <td><%= person.status %></td>
        <td><%= table_button_link 'Edit', edit_person_path(person) if can? :update, person %></td>
      </tr>
    <% end %>
  </tbody>
</table>
